md-dialog.newDatabaseDialog(aria-label="New database")
	md-toolbar
		.md-toolbar-tools
			h2 New Database
			span(flex)
			md-button.md-icon-button(ng-click="vm.closeDialog()")
				md-icon.angular-material-icons(aria-label="Close dialog") close
	md-content(layout-margin)
		div(layout="column")
			div(ng-if="!vm.newDatabaseToken", layout="column")
				md-input-container
					input(placeholder="Database name", autofocus, ng-model="vm.newDatabaseName")
				md-input-container
					md-button.md-raised.md-accent(ng-disabled="vm.newDatabaseButtonDisabled", ng-click="vm.saveNewDatabase()") Save

			div(ng-if="vm.newDatabaseToken")
				h3.databaseDialogInfo Database {{vm.newDatabaseName}} saved
				h3.databaseDialogInfo Please pay to finalise database creation
				form(action="https://www.sandbox.paypal.com/cgi-bin/webscr", method="post")
					input(type="hidden", name="cmd", value="_s-xclick")
					input(type="hidden", name="hosted_button_id", value="ETZVXP3F4Q4GE")
					input(type="hidden", name="custom", value="{{vm.newDatabaseToken}}")
					input(type="hidden", name="return", value="{{vm.paypalReturnUrl}}")
					div(layout="row", layout-align="start center")
						md-button.md-accent.md-raised(type="submit", ng-click="vm.setupPayment()", ng-disabled="vm.showPaymentWait") Pay
						div(ng-if="vm.showPaymentWait", layout="row", layout-align="start center")
							p Please wait...
							md-progress-circular(md-mode="indeterminate", md-diameter="20")

